package cn.net.yugu.doraemon.sharding.strategy.impl;

import cn.net.yugu.doraemon.sharding.model.ShardContext;
import cn.net.yugu.doraemon.sharding.strategy.ITableShardStrategy;
import org.joda.time.DateTime;

/**
 * @author wanghongli
 * @date 2023/12/16 14:47
 * @description DateTableShardStrategy
 **/
public class DateTableShardStrategy implements ITableShardStrategy {
    @Override
    public String generateTableName(String tableNamePrefix, ShardContext shardContext) {
        verifyTableNamePrefix(tableNamePrefix);
        return (tableNamePrefix + "_" + DateTime.now().toString(shardContext.getDateShardFormat())).intern();
    }
}
